<template>
	<!-- App -->
	<div id="app">
		<!-- Statusbar -->
		<f7-statusbar></f7-statusbar>
		<!-- login View -->
		<f7-view id="main-view" url="/login/" main></f7-view>
		<!-- loading -->
		<loading v-show="loadingState"></loading>
	</div>
</template>

<script>
	import { AndroidControl, JavascriptInterface } from "@/utils/AndroidBridge";
	import loading from '@/pages/loading.vue'
	export default {
		created: function() {
			//监听物理按键返回事件
			new JavascriptInterface().jsHistory(() => {
				let path = this.$f7.views.main.router.url.split('/')[1];
				// alert(path);
				if(path == "index" || path == "login") {
					return true;
				} else if (path == "big_form" || path == "visited_form" || path == "outPlace_form" || path == "oldTime_form" || path == "specialFood_form" || path == "bigThings_form" || path == "security_form" || path == "rollOver_form"){
					if(confirm('是否退出编辑？')){
						this.$f7.views.main.router.back();
					}
				}else {
					this.$f7.views.main.router.back();
				}
				return false;
			});
			//监听NFC扫描事件
			// new JavascriptInterface().jsNFCReceiver((tag) => {
			// 	alert(tag);
			// });
		},
		computed: {
			loadingState: function(){
				return this.$store.state.loading
			}
		},
		components:{
			loading
		}
}
</script>
<style>

</style>
